<?php if(!defined('BASEPATH'))exit('No direct script access allowed'); 

/*
 * Class string cat chuoi
 * @param string
 * @return string
 */

class urlutility
{
	function getcontent($idpost,$tieude){
		return base_url()."home/posts/index/".$idpost;
	}
	function getvideo($idvideo,$tieude){
		return base_url()."home/video/detail/".$idvideo;
	}
	function getalbum($idalbum,$tieude){
		return base_url()."home/album/detail/".$idalbum;
	}
	function gethotel($idhotel,$hotelname){
		return base_url()."home/hotel/detail/".$idhotel;
	}
	function gethotel_information($idhotel,$hotelname,$get){
		return base_url()."home/hotel/detail/".$idhotel.$get;
	}
	
	function getrestaurant($idrestaurant){
		return base_url()."home/restaurant/detail/".$idrestaurant;
	}
	function getpackage_information($idpackage,$packagename,$get){
		return base_url()."home/package/detail/".$idpackage.$get;	
	}
	function getpackage_customer_form(){
		return base_url()."home/package/customize";	
	}
	function getpackage_customerbyprovide($provide){
		return base_url()."home/package/package_customize?provide=".$provide;	
	}
	function getpackage_customer_form_create_interary(){
		return base_url()."home/package/package_customize_form_create_interary";	
	}
	function getguild_detail($idguild){
		return base_url()."home/guild/detail/".$idguild;	
	}
	function getcar_detail($idcar,$provide,$service,$type){
		return base_url()."home/car/detail/".$idcar."?provide=".$provide."&service=".$service."&type=".$type;	
	}
	function getactivity_detail($idactivity,$idname,$get){
		return base_url()."home/activity/detail/".$idactivity.$get;	
	}
	function getflight_roundtrip($idoneway,$get){
		return base_url()."home/flight/roundtrip?oneway=".$idoneway.$get;
	}
	function gethotelinmyanmar(){
		return base_url()."home/hotel/hotelinmyanmar";
	}
	function getpackageinmyanmar(){
		return base_url()."home/package/packageinmyanmar";
	}
	function getrestaurantinmyanmar(){
		return base_url()."home/restaurant/restaurantinmyanmar";
	}
	function getflightinmyanmar(){
		return base_url()."home/flight/flightinmyanmar";
	}
	function getactivityinmyanmar(){
		return base_url()."home/activity/activityinmyanmar";
	}
	function getdestinationinmyanmar(){
		return base_url()."home/destination/destinationinmyanmar";
	}
	function getfileimageonfolder($folder,$isoneimage=TRUE){
		if($isoneimage){
			if(is_dir($folder)){
				$listfile=glob($folder."/*.jpg",GLOB_NOSORT);
				if(count($listfile)>0) return $listfile[0];
				$listfile=glob($folder."/*.png",GLOB_NOSORT);
				if(count($listfile)>0) return $listfile[0];
				$listfile=glob($folder."/*.gif",GLOB_NOSORT);
				if(count($listfile)>0) return $listfile[0];
				return $folder;
			}else{
				return "error";
			}
		}else{
			if(is_dir($folder)){
				$a=array();
				$listfile=glob($folder."/*.jpg",GLOB_NOSORT);
				foreach($listfile as $file){
					$a[]=$file;
				}
				$listfile=glob($folder."/*.png",GLOB_NOSORT);
				foreach($listfile as $file){
					$a[]=$file;
				}
				$listfile=glob($folder."/*.gif",GLOB_NOSORT);
				foreach($listfile as $file){
					$a[]=$file;
				}
				return $a;
			}else{
				$a=array();
				return $a;
			}
		}
	}
}
?>